import type { Router } from 'vue-router'

export const createProgressGuard = (router: Router) => {
  router.beforeEach((to, from, next) => {
    window.$loadingBar?.start?.()
    next()
  })
  router.afterEach((to) => {
    window.$loadingBar?.finish?.()
  })
}
